Installing Nextcloud & Memories
- Video
- Installing Nextcloud
- Building the Custom Dockerfile
- Reverse Proxy Setup for Nextcloud
Installing Nextcloud
- Make a directory inside C:\Tools called Nextcloud
- You need to make 3 files inside your Nextcloud Directory. You can get the code that needs to go in these files from here. Nextcloud Building Files
- docker-compose.yml
- supervisord.conf
- nextcloud.ini
- Dockerfile
- cron.sh
- .collabora.env #Add if you want to use collabora and office on nextcloud
it will look like this when done
- We need to run our initial setup of nextcloud to do this we need to edit our docker-compose as seen in the video on youtube
- Once we have edited this we have to wait for initial configurations and once it says loaded we can connect to localhost:9111
- Set your Administrative Username for the Admin Account. Set your password for the admin account.
- set your data directory to wherever you want your images/videos to be placed.
- Set your mysql and database user and database password.
- Set your DB from localhost to db:3306
- Once all the categories are filled out click install. (NOTE): Installation may take upwards of 15-20 minutes.
- Once installed we need to go to Apps and install Memories
Enabled Go-Vod
- Now that Memories is installed we need to activate the go-vod in the compose for our nvidia GPU
- It Should look like below once we uncomment the go-vod section
version: '2'
services:
db:
image: mariadb:10.6
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes:
- C:\Tools\Nextcloud\db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=SQLROOTPASSWORD
- MYSQL_PASSWORD=MYSQLPASSOWRD
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
image: bankaitech/nextcloud:latest
restart: always
ports:
- 9111:80
links:
- db
volumes:
- J:/Nextcloud:/data
- J:/Nextcloud:/var/www/html
environment:
- MYSQL_DPASSWORD=MYSQLPASSWORD
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
cron:
image: bankaitech/nextcloud:latest
container_name: cron
restart: always
volumes:
- J:/Nextcloud:/var/www/html:z
depends_on:
- db
- redis
entrypoint: /cron.sh
redis:
container_name: redis
image: redis:latest
expose:
- 6379
command: redis-server --save 60 1 --loglevel warning
restart: always
#ONLY REMOVE THE # FOR HWA IF YOU HAVE A GPU AND WANT TO USE MEMORIES APP INSIDE NEXTCLOUD
go-vod:
image: radialapps/go-vod
restart: always
depends_on:
- app
# devices:
# - /dev/dri:/dev/dri # VA-API (omit for NVENC)
environment:
- NEXTCLOUD_HOST=https://NEXTCLOUD.DOMAIN.COM
- NEXTCLOUD_ALLOW_INSECURE=1 # (self-signed certs or no HTTPS)
volumes:
#this is where you want your files stored on nextcloud
- J:/Nextcloud:/data
#this is where your configs and all nextcloud system files are stored
- J:/Nextcloud:/var/www/html
#only enable if you have a nvidia 1xxx or later and want to use it to transcode
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
collabora:
container_name: collabora
hostname: collabora
privileged: true
tty: true
ports:
- 9980:9980
cap_add:
- MKNOD
image: collabora/code:latest
env_file:
- .collabora.env
restart: always
- Now we can run
docker compose up -d --force-recreate --remove-orphans
to recreate the container and remove old resources 5. We need to go into Adminstrative Settings ---> Memories ---> Binary Path and add in the connection address this
Bind Address
127.0.0.1:47788
Connection Adress
go-vod:47788
like so
- Now we can see if the hwa is working. So we need to go to Admin Settings on nextcloud ---> memories --> make the transcoding section look like below
- Now that thats done. We need to test so input a video inside nextcloud photos or any directory and try to play it. You should see two options when you select the gear icon
if you see this it is working correctly. Congrats!
You can also check docker desktop go-vod container and see if the logs say something alike to this
2023-12-19 00:12:38 2023/12/19 06:12:38 33w0pebs2le0-480p: /usr/local/bin/ffmpeg -loglevel warning -hwaccel cuda -i /var/www/html/data/__groupfolders/2/20231216_160438.mp4 -copyts -fflags +genpts -vf "format=nv12|cuda,hwupload,scale_cuda=force_original_aspect_ratio=decrease:passthrough=0:w=854:h=854" -map "0:v:0" "-c:v" h264_nvenc -preset p6 -tune ll -rc vbr -rc-lookahead 30 -cq 42 -temporal-aq 1 -map "0:a:0?" "-c:a" aac -ac 1 -start_number 0 -avoid_negative_ts disabled -f hls -hls_flags split_by_time -hls_time 3 -hls_segment_type mpegts -hls_segment_filename /tmp/go-vod/33w0pebs2le0-1296945068/480p-%06d.ts -force_key_frames "expr:gte(t,n_forced*3)" -
2023-12-19 00:12:40 2023/12/19 06:12:40 33w0pebs2le0-480p: recv 480p-000000.ts
2023-12-19 00:12:41 2023/12/19 06:12:41 33w0pebs2le0-480p: recv 480p-000001.ts
2023-12-19 00:12:42 2023/12/19 06:12:42 33w0pebs2le0-480p: recv 480p-000002.ts
2023-12-19 00:12:43 2023/12/19 06:12:43 ffmpeg-error: More than 1000 frames duplicated
2023-12-19 00:12:44 2023/12/19 06:12:44 33w0pebs2le0-480p: recv 480p-000003.ts
2023-12-19 00:12:45 2023/12/19 06:12:45 33w0pebs2le0-480p: recv 480p-000004.ts
2023-12-19 00:12:45 2023/12/19 06:12:45 33w0pebs2le0-480p: goal satisfied: 4
2023-12-19 00:12:46 2023/12/19 06:12:46 33w0pebs2le0-480p: resuming transcoding
2023-12-19 00:12:48 2023/12/19 06:12:48 33w0pebs2le0-480p: recv 480p-000005.ts
2023-12-19 00:12:49 2023/12/19 06:12:49 33w0pebs2le0-480p: recv 480p-000006.ts
2023-12-19 00:12:50 2023/12/19 06:12:50 33w0pebs2le0-480p: recv 480p-000007.ts
2023-12-19 00:12:51 2023/12/19 06:12:51 33w0pebs2le0-480p: recv 480p-000008.ts
2023-12-19 00:12:51 2023/12/19 06:12:51 33w0pebs2le0-480p: goal satisfied: 8
Building the Custom Dockerfile for FFMPEG & Facial Recognition
We will now build our custom repo for with ffmpeg previews and facial recognition
- Open Terminal/Powershell and run inside C:\Tools\Nextcloud
docker build . -t nextcloud-apache-ffmpeg
- It should start building the custom repo
- Once done we need to edit our docker-compose.yml to use that repo so edit it like so.
version: '2'
services:
db:
image: mariadb:10.6
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes:
- C:\Tools\Nextcloud\db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=SQLROOTPASSWORD
- MYSQL_PASSWORD=MYSQLPASSOWRD
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
image: nextcloud-apache-ffmpeg
restart: always
ports:
- 9111:80
links:
- db
volumes:
- J:/Nextcloud:/data
- J:/Nextcloud:/var/www/html
environment:
- MYSQL_DPASSWORD=MYSQLPASSWORD
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
cron:
image: bankaitech/nextcloud:latest
container_name: cron
restart: always
volumes:
- J:/Nextcloud:/var/www/html:z
depends_on:
- db
- redis
entrypoint: /cron.sh
redis:
container_name: redis
image: redis:latest
expose:
- 6379
command: redis-server --save 60 1 --loglevel warning
restart: always
#ONLY REMOVE THE # FOR HWA IF YOU HAVE A GPU AND WANT TO USE MEMORIES APP INSIDE NEXTCLOUD
go-vod:
image: radialapps/go-vod
restart: always
depends_on:
- app
# devices:
# - /dev/dri:/dev/dri # VA-API (omit for NVENC)
environment:
- NEXTCLOUD_HOST=https://NEXTCLOUD.DOMAIN.COM
- NEXTCLOUD_ALLOW_INSECURE=1 # (self-signed certs or no HTTPS)
volumes:
#this is where you want your files stored on nextcloud
- J:/Nextcloud:/data
#this is where your configs and all nextcloud system files are stored
- J:/Nextcloud:/var/www/html
#only enable if you have a nvidia 1xxx or later and want to use it to transcode
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
collabora:
container_name: collabora
hostname: collabora
privileged: true
tty: true
ports:
- 9980:9980
cap_add:
- MKNOD
image: collabora/code:latest
env_file:
- .collabora.env
restart: always
We are only changing this line for others who changed mysql password and other things From
app:
image: nextcloud:production
to
app:
image: nextcloud-apache-ffmpeg
- Once this is done we can rebuild and docker-compose again by typing
docker compose up -d --force-recreate --remove-orphans
- This time we should now have ffmpeg and facial recognition now ready.
- So go into the Admin Settings and go to Memories then this
- to find ffmpeg location go to docker find your nextcloud app and click on the 3 dots next to our app and select terminal like so
- type 2 commands to give us our ffmpeg and ffprobe binary's
whereis ffmpeg
whereis ffprobe
- Copy the path into those empty ffmpeg paths box and ffprobe path box.
- Once you click out of the box it should update.
Installing Facial Recognition
- Now we need 2 more apps from the app store. So we go to Adminstrative Panel --> Apps ---> Recognize Adminstrative Panel ---> Apps ---> Preview Generator
- Once this is done we need to enable recognize inside the Adminstrative Settings ---> Recognize and enable the slider
Reverse Proxy Setup for Nextcloud
- Open Your Nextcloud /var/html/www directory. For me thats in J:/Nextcloud. If you do not know where this is go to your Docker-Compose.yml and look for this line
The Folder Should Look Like this!
- Go into Config Folder and Open Config.php
- Add these lines below
'trusted_domains' =>
array (
0 => 'NEXTCLOUD.DOMAIN.COM',
# 1 => 'OFFICE.DOMAIN.COM', #UCOMMENT THIS IF YOU HAVE ADDED collabora TO YOUR INSTALL
),
'trusted_proxies' =>
array (
0 => '127.0.0.1', #adding localhost for local use
1 => '192.168.x.xxx', #add your ip for your local machine here
2 => '172.19.0.1', #This is our docker internal ip
),
'forwarded_for_headers' =>
array (
0 => 'HTTP_X_FORWARDED_FOR',
),
it should look like this
- Now SAVE and run the commands below in Powershell
docker compose down
docker compose up -d